<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>微信公众号接口测试</title>
    <script>
        function getAccessToken() {
            var appid = document.getElementById("appid").value;
            var appsecret = document.getElementById("appsecret").value;
            var token_url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + appsecret;
            fetch(token_url)
                .then(response => response.json())
                .then(data => {
                    document.getElementById("access_token").innerText = data.access_token;
                })
                .catch(error => {
                    console.error('Error:', error);
                });
        }
    </script>
</head>
<body>
    <h1>微信公众号接口测试</h1>
    <label for="appid">AppID:</label>
    <input type="text" id="appid" name="appid"><br><br>
    <label for="appsecret">AppSecret:</label>
    <input type="text" id="appsecret" name="appsecret"><br><br>
    <button type="button" onclick="getAccessToken()">获取Access Token</button>
    <p id="access_token"></p>
</body>
</html>